package com.test.main;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.test.dao.UserDAO;
import com.test.entity.User;

public class UserTestSpring {
	public static void main(String[] args) throws Exception {
		ApplicationContext context = new FileSystemXmlApplicationContext(
				"classpath:spring.xml");
		UserDAO userDAO = (UserDAO) context.getBean("userDAO");
		User user = new User();
		user.setNickname("李明");
		user.setPasswd("123");
		user.setPhoneno("123456789");
		user.setEmail("sunbo@126.com");
		userDAO.insert(user);
		//List<User> list=userDAO.findByProperty("name", "丽丽");
		
		List<User> list=userDAO.findList("from User where id = ?",2);
		for(int i=0;i<list.size();i++){
			System.out.println("name="+list.get(i).getNickname()+",clazz="+list.get(i).getPasswd());
		}
		
		
		
	}
}